//Wed Mar  9 15:12:18 CST 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class AdditionGame
{
public:

    int getMaximumPoints(int A, int B, int C, int N)
    {
        if (N == 0) return 0;

        if (A >= B && A >= C && A > 0)
            return A + getMaximumPoints(A - 1, B, C, N - 1);
        if (B >= C && B >= A && B > 0)
            return B + getMaximumPoints(A, B - 1, C, N - 1);
        if (B <= C && C >= A && C > 0)
            return C + getMaximumPoints(A, B, C - 1, N - 1);
        return 0;
    }
};
